package jdbc;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

public class JdbcDemo4 {
    public static void main(String[] args) throws SQLException {
        Connection connection = DBUtil.getConnection();
        Statement statement = connection.createStatement();
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入用户名");
        String username = sc.nextLine();
        System.out.println("请输入密码");
        String password = sc.nextLine();
        String sql = "insert into userinfo(username,password)"+" values('"+username+"','"+password+"')";
        int i = statement.executeUpdate(sql);
        if (i>0){
            System.out.println("成功");
        }
        connection.close();


    }
}
